<template>
	<view>
		<view class="cu-card dynamic" :class="isCard?'no-card':''" v-for="(item,i) in taskExecList" :key="i">
			<view class="cu-item shadow">
				<view class="cu-list menu-avatar">
					<view class="cu-item">
						<view class="content flex-sub">
							<view>{{item.title}}</view>
							<view class="text-gray text-sm flex justify-between">
								{{item.createTime}}
							</view>
						</view>
					</view>
				</view>
				<view class="text-content">
					{{item.content}}
				</view>
				<view class="grid flex-sub padding-lr" :class="isCard?'col-3 grid-square':'col-1'">
					<image style="width: 300px; height: 300px; background-color: #eeeeee;" :src="item.picUrl"
						@error="imageError"></image>
				</view>
				<view class="grid flex-sub padding-lr" :class="isCard?'col-3 grid-square':'col-1'">
					<video id="myVideo" :src="item.videoUrl" @error="videoErrorCallback" controls></video>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	// import uniList from '../../components/uni-list/uni-list.vue'
	export default {
		// components: {
		// 	uniList
		// },
		data() {
			return {
				taskExecList: []
			}
		},
		created() {
			this.getData();
		},
		onReady: function(res) {
			this.videoContext = uni.createVideoContext('myVideo')
		},
		methods: {
			getData() {
				let stuId = 1
				stuId = uni.getStorageSync('stuId');
				uni.request({
					url: 'http://localhost:8082/task_admin/task-exec/query?stuId=' + stuId,
					success: (res) => {
						console.log(res)
						if (res.data.code == 200) {
							this.taskExecList = res.data.data
						}
					}
				})
			},
			imageError: function(e) {
				console.error('image发生error事件，携带值为' + e.detail.errMsg)
			},
			videoErrorCallback(e) {
				uni.showModal({
					content: e.target.errMsg,
					showCancel: false
				})
			}
		}
	}
</script>

<style>
</style>
